//
//  ViewController.m
//  erweima
//
//  Created by 廖挺 on 15/11/3.
//  Copyright © 2015年 liaoting. All rights reserved.
//

#import "ViewController.h"
#import "ScanViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *showLabel;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
}


//点击二维码
- (IBAction)click:(id)sender {
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    ScanViewController *vc = (ScanViewController *)[sb instantiateViewControllerWithIdentifier:@"Scan"];
    vc.metadataType = metadataTypeQRCode;
    vc.callbackResult = ^(NSString *resultString) {
        self.showLabel.text = resultString;
    };
    [self presentViewController:vc animated:YES completion:nil];
}

//点击条形码
- (IBAction)barClick:(id)sender {
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    ScanViewController *vc = (ScanViewController *)[sb instantiateViewControllerWithIdentifier:@"Scan"];
    vc.metadataType = metadataTypeBarCode;
    vc.callbackResult = ^(NSString *resultString) {
        self.showLabel.text = resultString;
    };
    [self presentViewController:vc animated:YES completion:nil];
}


@end
